/**
 * 需求：根据查询的用户身份(roleId)来判断左侧菜单及操作权限
 * 在 AuthMenu.Vue 中查询分配权限！！
 *
 * [新增菜单接口：](http://59.107.26.181:8084/swagger-ui.html#!/auth-menu-api-controller/createUsingPOST_1)
 *
 *
 * **/


import Vue from 'vue'
import Vuex from 'vuex'
import btnConfig from './modules/btnConfig'
Vue.use(Vuex)
    // const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  modules: {
    btnConfig
  },
  state: {
    actType: {},
    chgStatusActId: '',
    chgStatusActFormVisible: '',
    pushActId: '',
    pushFormVisible: '',
    menu: [], //左侧菜单栏
    roleId: ''//Nav 权限ID
  },
  getters: {
    getRoleId: state => { return state.roleId },
    getMainMenu: state => { return state.menu },

  },
  mutations: {
    selActivityType (state, actTypeInfo) {
      state.actType = actTypeInfo;
    },
    SET_ChgStatusActId (state, activityId) {
      state.chgStatusActId = activityId;
    },
    SET_ChgStatusActFormVisible (state, visible) {
      state.chgStatusActFormVisible = visible;
    },
    SET_PushActId (state, activityId) {
      state.pushActId = activityId;
    },
    SET_PushFormVisible (state, visible) {
      state.pushFormVisible = visible;
    },
    setMenu (state, menuList) {
      state.menu = menuList
    },
    SET_RoleId (state, roleId) { // 权限ID
      state.roleId = roleId
    }
  },
  actions: {
    selActivityType (context, actTypeInfo) {
      context.commit('selActivityType', actTypeInfo)
    },
    setRoleId (context, roleId) {
      context.commit('SET_RoleId', roleId)
    },
    setMenuList (context, menuList) {
      context.commit('setMenu', menuList)
    }
  }
})
